home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 280_01 / filset.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-01-11  |  2.1 KB  |  64 lines

  1. /* [filset.c of JUGPDS Vol.17] */
  2. /*
  3. *****************************************************************
  4. *                                *
  5. *    Written by  Hakuo Katayose (JUG-CP/M No.179)        *
  6. *            49-114 Kawauchi-Sanjuunin-machi        *
  7. *            Sendai, Miyagi 980                          *
  8. *            Phone: 0222-61-3219                *
  9. *                                *
  10. *       Modifird by Toshiya Oota   (JUG-CPM No.10)              *
  11. *                   Sakae ko-po 205                 *
  12. *            5-19-6 Hosoda                *
  13. *            Katusikaku Tokyo 124            *
  14. *                                *
  15. *        for MS-DOS Lattice C V3.1J & 80186/V20/V30    *
  16. *                                *
  17. *    Compiler Option: -ccu -k0(1) -ms -n -v -w        *
  18. *                                *
  19. *    Edited & tested by Y. Monma (JUG-CP/M Disk Editor)    *
  20. *            &  T. Ota   (JUG-CP/M Sub Disk Editor)    *
  21. *                                *
  22. *****************************************************************
  23. */
  24.  
  25. /* Library functions for Software Tools */
  26.  
  27. #include "stdio.h"
  28. #include "dos.h"
  29. #include "ctype.h"
  30. #include "tools.h"
  31.  
  32. /* filset - expand set at array[i] into set[j], stop at delim */ 
  33. void filset(delim, array, i, set, j, maxsiz)
  34. int    *i, *j, maxsiz;
  35. char    array[], delim, set[];
  36.  
  37. {
  38. char    *digits, *lowalf, *upalf ,*kana, c;
  39. void dodash();
  40.  
  41.     digits = "0123456789";
  42.     lowalf = "abcdefghijklmnopqrstuvwxyz";
  43.     upalf  = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  44.     kana   = "ªºº¿⌐¬½¼¡«»▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄ª▌";
  45.     for (; (c = array[*i]) != delim && c != EOS; (*i)++)
  46.         if (c == ESCAPE)            /*Modify 1986-11-27*/
  47.             addset(esc(array, i), set, j, maxsiz);
  48.         else if (c != DASH)
  49.             addset(c, set, j, maxsiz);    /*Modify 1986-11-27*/
  50.         else if (*j == 0 || array[(*i)+1] == EOS)  /*Last Literal*/
  51.             addset(DASH, set, j, maxsiz);
  52.         else if (cindex(digits, set[(*j)-1]) != ERROR)
  53.             dodash(digits, array, i, set, j, maxsiz);
  54.         else if (cindex(lowalf, set[(*j)-1]) != ERROR)
  55.             dodash(lowalf, array, i, set,j, maxsiz);
  56.         else if (cindex(upalf, set[(*j)-1])  != ERROR)
  57.             dodash(upalf, array, i, set, j, maxsiz);
  58.         else if (cindex(kana , set[(*i)-1])  != ERROR)
  59.             dodash(kana , array, i, set, j, maxsiz);
  60.         else
  61.             addset(DASH, set, j, maxsiz);
  62.     return;
  63. }
  64.